﻿@model EmployeeApp.Web.Models.Employee.EmployeeModel

@{
    ViewBag.Title = "AddEmployee";
}

@section Styles {
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        $(function() {
            $.datepicker.setDefaults( $.datepicker.regional[ "th" ] );
            $( "#BirthDate" ).datepicker({
                buttonImage: '../../images/datepicker.png',
                changeMonth: true, changeYear: true,
                defaultDate: new Date(),
                maxDate: new Date(),
                yearRange: 'c-70:c',
                minDate: '-71Y',
            });
        });
        
    </script>
}

<h2>New Employee</h2>


@using (Html.BeginForm("Add", "Employee")) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>EmployeeModel</legend>
        <div class="two-column-container">
            <div class="texteditor">
                @Html.LabelFor(model => model.EmpId)
                @Html.EditorFor(model => model.EmpId)
                @Html.ValidationMessageFor(model => model.EmpId)
                <input type="hidden" name="Mode" value="Add" />
            </div>

            <div class="texteditor">
                @Html.LabelFor(model => model.Title)
                @Html.RadioButtonFor(model => model.Title,"1") Mr.
                @Html.RadioButtonFor(model => model.Title,"2") Miss.
                @Html.RadioButtonFor(model => model.Title,"3") Mrs.

                @Html.ValidationMessageFor(model => model.Title)
            </div>
        </div>

        <div class="two-column-container">
            <div class="texteditor">
                @Html.LabelFor(model => model.Name)
                @Html.EditorFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </div>

            <div class="texteditor">
                @Html.LabelFor(model => model.Surname)
                @Html.EditorFor(model => model.Surname)
                @Html.ValidationMessageFor(model => model.Surname)
            </div>
        </div>

        <div class="two-column-container">
            <div class="texteditor">
                 @{
                    var listItems = new List<System.Web.UI.WebControls.ListItem> 
                    { 
                          new System.Web.UI.WebControls.ListItem { Text = "Programmer", Value = "1" },
                          new System.Web.UI.WebControls.ListItem { Text = "Programmer Analyst", Value = "2" }, 
                          new System.Web.UI.WebControls.ListItem { Text = "System Analyst", Value = "3" } 
                    };
                 }

                @Html.LabelFor(model => model.JobTitle)
                @*@Html.EditorFor(model => model.JobTitle)*@
                @Html.DropDownListFor(model => model.JobTitle,new SelectList(listItems,"Value","Text"))
                @Html.ValidationMessageFor(model => model.JobTitle)
            </div>

             <div class="texteditor">
                @Html.LabelFor(model => model.Status)
                <span class="inline">
                @Html.RadioButtonFor(model => model.Status,"1")@Html.Raw(EmployeeApp.Web.Utilities.status.Active.ToString())
                @Html.RadioButtonFor(model => model.Status, "2")@Html.Raw(EmployeeApp.Web.Utilities.status.Inactive.ToString())
                </span>
                @Html.ValidationMessageFor(model => model.Status)
            </div>
        </div>

        <div class="two-column-container">
            <div class="texteditor">
                @Html.LabelFor(model => model.MarriedStatus)
                <span class="inline">
                @Html.RadioButtonFor(model => model.MarriedStatus, "1")@Html.Raw(EmployeeApp.Web.Utilities.MarrigedStatusUtil.Single.ToString())
                @Html.RadioButtonFor(model => model.MarriedStatus, "2")@Html.Raw(EmployeeApp.Web.Utilities.MarrigedStatusUtil.Married.ToString())
                </span>
                @Html.ValidationMessageFor(model => model.MarriedStatus)
            </div>

             <div class="texteditor">
                @Html.LabelFor(model => model.BirthDate)
                @Html.EditorFor(model => model.BirthDate, new { @readonly="readonly" })
                @Html.ValidationMessageFor(model => model.BirthDate)
            </div>
        </div>
        <div class="two-column-container">
            <div class="texteditor">
                @Html.LabelFor(model => model.Address)
                @Html.TextAreaFor(model => model.Address)
                @Html.ValidationMessageFor(model => model.Address)
            </div>
        </div>

        <div class="bottom-menu clear">
            <input type="submit" value="Add" />
            <input id="cancel" onclick="location.href='@Url.Action("ListEmployee", "Employee")'" type="button" value="Cancel" />
        </div>
    </fieldset>
}
